package pl.poznan.put.cs.to.tsp.localsearch;

import java.util.Collection;
import java.util.LinkedList;
import java.util.Queue;

import pl.poznan.put.cs.to.tsp.common.ConstantsHolder;

public class TabuManager {
	private Queue<Integer> tabuVertexes;

	public TabuManager() {
		this.tabuVertexes = new LinkedList<Integer>();
	}

	public void add(Integer i) {
		this.tabuVertexes.add(i);
		if (this.tabuVertexes.size() > ConstantsHolder.MAX_TABU_VERTEXES) {
			this.tabuVertexes.remove();
		}
	}

	public void add(Collection<Integer> ints) {
		this.tabuVertexes.addAll(ints);
		while (this.tabuVertexes.size() > ConstantsHolder.MAX_TABU_VERTEXES) {
			this.tabuVertexes.remove();
		}
	}

	public boolean isTabuVertex(Integer i) {
		return this.tabuVertexes.contains(i);
	}
}
